A1 = readmatrix ('NiI2_CPGE_Spectra_-24V_30K_500-550.csv')
A2 = readmatrix ('NiI2_CPGE_Spectra_-24V_30K_550-600.csv')
A3 = readmatrix ('NiI2_CPGE_Spectra_-24V_30K_600-650_2.csv')
A4 = readmatrix ('NiI2_CPGE_Spectra_-24V_30K_650-700.csv')
A5 = readmatrix ('NiI2_CPGE_Spectra_-24V_30K_700-750.csv')
%B = readmatrix('supercontinuum_power_calibration.csv')

x1 = A1(:,1)
y1 = A1(:,3)*1e12*2.45
y2 = A1(:,5)*1e12*2.45
y3 = A1(:,7)

x2 = A2(:,1)
m1 = A2(:,3)*1e12
m2 = A2(:,5)*1e12
m3 = A2(:,7)

x3 = A3(:,1)
n1 = A3(:,3)*1e11*7.8
n2 = A3(:,5)*1e11*7.8
n3 = A3(:,7)

x4 = A4(:,1)
h1 = A4(:,3)*1e11*1.65
h2 = A4(:,5)*1e11*1.65
h3 = A4(:,7)

x5 = A5(:,1)
g1 = A5(:,3)*1e11
g2 = A5(:,5)*1e11
g3 = A5(:,7)

x = cat(1,x1,x2,x3,x4,x5)
r1 = cat(1,y1,m1,n1,h1,g1)
r2 = cat(1,y2,m2,n2,h2,g2)
r3 = cat(1,y3,m3,n3,h3,g3)

data = cat(2,x,r1,r2,r3)

writematrix(data,'CD_500_750nm.txt')

hold on
plot(x1,y1,LineWidth=1,Color=[0.8 0 0])
plot(x1,y2,LineWidth=1,Color=[0 0 0.8])
plot(x2,m1,LineWidth=1,Color=[0.8 0 0])
plot(x2,m2,LineWidth=1,Color=[0 0 0.8])
plot(x3,n1,LineWidth=1,Color=[0.8 0 0])
plot(x3,n2,LineWidth=1,Color=[0 0 0.8])
plot(x4,h1,LineWidth=1,Color=[0.8 0 0])
plot(x4,h2,LineWidth=1,Color=[0 0 0.8])
plot(x5,g1,LineWidth=1,Color=[0.8 0 0])
plot(x5,g2,LineWidth=1,Color=[0 0 0.8])
xlim([500,750])
xticks(500:50:750)
%ylim([0,0.11])
%yticks([0:0.05:0.1])
set(gca,'XMinorTick','on','YMinorTick','on')
set(gca,'box','on','Xcolor',[0 0 0],'Ycolor',[0 0 0])
hold off
box on
set(gcf,'Position',[0, 0, 200, 200])